import com.example.c3p0.Util.C3p0Util;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @auther 尚智江
 * @Date 2022/5/14 22:26
 */
public class UpdateDao {
    public static void main(String[] args)throws SQLException {
        // 创建 QueryRunner 对象
        QueryRunner queryRunner = new QueryRunner(C3p0Util.getDataSource());
        String sql = "UPDATE user SET user='hellaaa', password=1111 WHERE user='hello2'";
        int num = queryRunner.update(sql);
        if(num>0){
            System.out.println("更改成功！");
        }else {
            System.out.println("更改失败！");
        }
    }
}
